﻿@using EC.Entity.Response.Customer
@using EC.Entity.Enum

@model EC.Entity.PagedList<CustomerQueryResponse>
<div class="data-body data-scroll">
    <div class="data-view">
        <div class="data-div-view table-responsive">
            <table class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                        <th class="t_l">账号</th>
                        <th width="100">点数</th>
                        <th width="100">登录次数</th>
                        <th width="100">登录Ip</th>
                        <th width="75">状态</th>
                        <th class="t_l" width="130">创建时间</th>
                        <th width="220">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.TData != null && Model.TData.Any())
                    {
                        foreach (var item in (IEnumerable<CustomerQueryResponse>)Model.TData)
                        {
                    <tr>
                        <td class="t_l">@(item.Account)</td>
                        <td width="100">
                            <a class="btn-danger btn-xs" data-modal="/Customer/PointsLog?customerId=@(item.Id)" data-title="点数记录" data-bottom="remove" data-width="700" data-height="480">@(item.Points)</a>
                        </td>
                        <td width="100">@(item.LoginCount)</td>
                        <td width="100">@(item.LastLoginIP)</td>
                        <td width="75">
                            @(item.Status == (sbyte)CustomerStatus.启用 ? Html.Raw("<span class='green bold'>启用</span>") : Html.Raw("<span class='red bold'>禁用</span>"))
                        </td>
                        <td width="130">@(item.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss"))</td>
                        <td width="220">
                            <button type="button" class="btn btn-default btn-xs" data-modal="/Customer/Reset?customerId=@(item.Id)" data-title="授权" data-width="452" data-height="150">
                                <span class="glyphicon glyphicon-edit"></span> 重置
                            </button>
                            <button type="button" class="btn btn-default btn-xs" data-modal="/Customer/Token?customerId=@(item.Id)" data-title="授权" data-width="452" data-height="200">
                                <span class="glyphicon glyphicon-edit"></span> 授权
                            </button>
                            @if (item.Status == (sbyte)CustomerStatus.启用)
                            {
                                <a class="btn btn-danger btn-xs" data-confirm="确定要禁用该权限？" data-succesFun="doSearch" data-href="/Customer/UpdateStatus?id=@(item.Id)&status=@((sbyte)CustomerStatus.禁用)">禁用</a>
                            }
                            else
                            {
                                <a class="btn btn-primary btn-xs" data-confirm="确定要启用该权限？" data-succesFun="doSearch" data-href="/Customer/UpdateStatus?id=@(item.Id)&status=@((sbyte)CustomerStatus.启用)">启用</a>
                            }
                            <button type="button" class="btn btn-default btn-xs" data-modal="/Customer/AddOrEdit/@(item.Id)" data-title="编辑" data-width="452" data-height="200">
                                <span class="glyphicon glyphicon-edit"></span> 编辑
                            </button>
                        </td>
                    </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="3" class="t_c">暂无记录</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 必要的分页参数设置 -->
<input type="hidden" id="TotalCount" value="@(Model != null ? Model.TotalCount : 0)" />